package com.eusoft.demo_project.mapper;

import com.eusoft.demo_project.entity.Car;
import com.eusoft.demo_project.entity.Car_state;
import com.eusoft.demo_project.entity.Car_type;
import com.eusoft.demo_project.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface CarManageMapper {


    //查询车辆类型表
    List<Car_type> queryCarTypeList();

    //查询车辆状态表
    List<Car_state> queryCarStateList();

    //按条件查询车辆数量
    Integer countCarList( @Param("id")Integer id,
                      @Param("stateId")Integer stateId,
                      @Param("search")String search);

    //按条件查询车辆信息列表
    List<Car> queryCarList(Integer offset, Integer pageRows,
                           @Param("id")Integer id,
                           @Param("stateId")Integer stateId,
                           @Param("search")String search);

    //根据车辆的aid查询
    Car queryCarDetail(Integer aid);

    void deleteCarUser(Integer aid);
    void deleteCar(Integer aid);

    List<User> queryCarUserList(Integer aid,Integer offset, Integer pageRows);
    Integer countCarUser(Integer aid);

    List<Integer> queryCarUserInfo(Integer aid);

    List<User> queryAllUser();

    List<String> queryAllCarPlateCode();
    List<String> queryAllCarPlateCodeExceptById(Integer aid);

    void addCar(String plate_code, String brand, Integer type_id, String type_name, Integer state_id, String state_name, Integer approved_num, String memo, Date time_add,Date time_update_last);
    void updateCar(Integer aid,String plate_code,String brand, Integer type_id, String type_name, Integer state_id, String state_name, Integer approved_num, String memo, Date time_update_last);
    void addCarUser(Integer car_aid,Integer user_aid,Date time_add,Date time_update_last);
    void deleteCarUserByUser(Integer car_aid,Integer user_aid);
    Integer queryCarIdByPlateCode(String plate_code);
    List<Integer> queryCarUserIdList(Integer carId);

    String queryTypeNameById(Integer typeId);
    String queryStateNameById(Integer stateId);







}
